import { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome'
import classNames from 'classnames'

export type themeProps = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'light' | 'dark'

interface IconProps extends  FontAwesomeIconProps {
    theme?:themeProps,
    className?:string,
}

const Icon = ({
    icon,
    theme,
    className,
    ...restProps
}:IconProps) => {
    const classes = classNames('leo-icon', className,{
        [`icon-${theme}`]:theme                                                                         
    })
    return (
        <FontAwesomeIcon icon={icon} className={classes} {...restProps}/>
    )
}

export default Icon